Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: feed oracle with meTokens price every endBlock #2316

Merged
merged 24 commits into from
Nov 14, 2023

Conversation

kosegor
Copy link
Contributor

@kosegor kosegor commented Nov 7, 2023

  • Sends every meToken price each endBlock to x/oracle
  • Avoid adding meTokens to x/oracle accept list when they are added to x/leverage registry. This is done to exclude validators from reporting and voting on the price, as well as being slashing for not reporting it.

@kosegor kosegor requested review from a team as code owners November 7, 2023 16:20
Copy link
Member

@toteki toteki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check to see if GetExchangeRate works in oracle module.

(It might not know the symbol denom <-> base denom relationship for metokens)

@@ -11,5 +11,6 @@
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimLeverageInterest())
util.Panic(k.RebalanceReserves())
util.Panic(k.SetPricesToOracle())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
@@ -11,5 +11,6 @@
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimLeverageInterest())
util.Panic(k.RebalanceReserves())
util.Panic(k.SetPricesToOracle())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #2316 (336d25b) into main (7f05ad4) will decrease coverage by 4.91%.
Report is 290 commits behind head on main.
The diff coverage is 66.20%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2316      +/-   ##
==========================================
- Coverage   75.38%   70.48%   -4.91%     
==========================================
  Files         100      170      +70     
  Lines        8025    12902    +4877     
==========================================
+ Hits         6050     9094    +3044     
- Misses       1589     3203    +1614     
- Partials      386      605     +219     
Files Coverage Δ
ante/ante.go 66.66% <100.00%> (+18.45%) ⬆️
ante/fee.go 80.00% <100.00%> (+1.64%) ⬆️
ante/spam_prevention.go 75.92% <ø> (ø)
app/inflation/inflation.go 100.00% <100.00%> (ø)
app/upgradev3/migrations.go 85.71% <ø> (+7.45%) ⬆️
util/coin/utoken.go 100.00% <100.00%> (ø)
util/ibc/ibc.go 58.82% <ø> (ø)
util/sdkutil/events.go 0.00% <ø> (ø)
x/incentive/client/tests/suite.go 100.00% <ø> (ø)
x/incentive/client/tests/tests.go 100.00% <ø> (ø)
... and 41 more

... and 101 files with indirect coverage changes

contrib/scripts/mockgen.sh Outdated Show resolved Hide resolved
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. Did you check if we need to check slashing condition in oracle? We don't want oracle module to both:

  • require validators to submit meToken prices
  • slash them if they don't submit

x/metoken/keeper/mocks_test.go Show resolved Hide resolved
x/metoken/keeper/price.go Outdated Show resolved Hide resolved
@kosegor
Copy link
Contributor Author

kosegor commented Nov 13, 2023

utACK. Did you check if we need to check slashing condition in oracle? We don't want oracle module to both:

  • require validators to submit meToken prices
  • slash them if they don't submit

Yes, I checked it with Adam and oracle team. After the token is added to leverage registry we are NOT adding it to oracle accept list.

@kosegor kosegor added this pull request to the merge queue Nov 14, 2023
Merged via the queue into main with commit 21c69e2 Nov 14, 2023
24 of 26 checks passed
@kosegor kosegor deleted the egor/metoken-price-oracle branch November 14, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants